<?php
namespace models\repositories;
use Doctrine\ORM\EntityRepository;
use entities;
class CategoryPathRepository extends EntityRepository {
	public function testIterate(){
		echo "<br>iterasi x";
	}
	public function findAllAsObject(){
		$qb = $this->_em->createQueryBuilder();		
		$qb->select('Kategori')
		   ->from('models\entities\Kategori', 'Kategori')
		;
		
		$query = $qb->getQuery();
		return $query->getResult();
	}
	
	public function findCategoryPathLikeByPath($path){
		$qb = $this->_em->createQueryBuilder();		
		$qb->select('CategoryPath')
		   ->from('models\entities\CategoryPath', 'CategoryPath')
		   ->where('CategoryPath.categoryId=?1')
		;
		$qb->setParameter(1, "%".$path."%");
		$query = $qb->getQuery();
		return $query->getResult();
	}
	
	
}

